<div data-ng-controller="contractIncomeCtrl">
    <div class="table-header clearfix ng-scope">
        <span class="fl lh30 f14">{{contractBaseInfo.contract_code}}</span>
    </div>
    <form class="form-horizontal">
        <div class="form-group mt10">
            <span for="inputtext3" class="col-sm-3 control-label">签约金额</span>

            <div class="col-sm-5">
                <input type="number" number required min="0" ng-model="contractBaseInfo.sign_amount"
                       class="form-control align-r" id="inputtext3" data-ng-disabled="true" placeholder="签约金额">
            </div>

            <span for="inputtext3" class="col-sm-3 control-label">应结算金额</span>

            <div class="col-sm-5">
                <input type="number" number required min="0" ng-model="contractBaseInfo.balance_should_amount"
                       class="form-control align-r" id="inputtext3" data-ng-disabled="true" placeholder="应结算金额">
            </div>

            <span for="inputtext3" class="col-sm-3 control-label">已结算金额</span>

            <div class="col-sm-5">
                <input type="number" number required min="0" ng-model="contractBaseInfo.balance_amount"
                       class="form-control align-r" id="inputtext3" data-ng-disabled="true" placeholder="已结算金额">
            </div>
        </div>
        <div class="form-group mt10">
            <span for="inputtext3" class="col-sm-3 control-label">应确认收入</span>

            <div class="col-sm-5">
                <input type="number" number required min="0" name="should_confirm_income_amount"
                       class="form-control align-r" id="inputtext3" data-ng-disabled="true"
                       value="{{incomes|sumAmount}}"
                       placeholder="应确认收入">
            </div>

            <span for="inputtext3" class="col-sm-3 control-label">已确认收入</span>

            <div class="col-sm-5">
                <input type="number" number required min="0" name="have_confirm_income_amount"
                       class="form-control align-r" id="inputtext3" data-ng-disabled="true"
                       value="{{incomes|sumHaveConfirmAmount}}"
                       placeholder="已确认收入">
            </div>

            <span for="inputtext3" class="col-sm-3 control-label">待确认收入</span>

            <div class="col-sm-5">
                <input type="number" number required min="0" name="will_confirm_income_amount"
                       class="form-control align-r" id="inputtext3" data-ng-disabled="true"
                       value="{{incomes|sumWillConfirmAmount}}"
                       placeholder="待确认收入">
            </div>
        </div>
        <div class="form-group mt10">
            <span for="inputtext3" class="col-sm-3 control-label">已确认发生坏账</span>

            <div class="col-sm-5">
                <input type="number" number required min="0" name="have_confirm_bad_amount"
                       class="form-control align-r" id="inputtext3" data-ng-disabled="true"
                       value="{{incomes|sumHaveConfirmBadAmount}}"
                       placeholder="已确认发生坏账">
            </div>

            <span for="inputtext3" class="col-sm-3 control-label">未确认已发生坏账</span>

            <div class="col-sm-5">
                <input type="number" number required min="0" name="no_confirm_bad_amount"
                       class="form-control align-r" id="inputtext3" data-ng-disabled="true"
                       value="{{incomes|sumNoConfirmBadAmount}}"
                       placeholder="未确认已发生坏账">
            </div>

            <span for="inputtext3" class="col-sm-3 control-label">金蝶核销坏账</span>

            <div class="col-sm-5">
                <input type="number" number required min="0" name="kingdie_confirm_bad_amount"
                       class="form-control align-r" id="inputtext3" data-ng-disabled="true"
                       value="{{incomes|sumKingdieConfirmBadAmount}}"
                       placeholder="金蝶核销坏账">
            </div>
        </div>
        <hr>
        <div class="mt3 clearfix ng-scope ml25">
            <span class="fl lh30 f14 c-orange">收入项信息</span>
        </div>

        <div class="form-group mt10">
            <span for="inputtext3" class="col-sm-3 control-label">账套公司</span>

            <div class="col-sm-5">
                <input select2 ng-model="contractBaseInfo.account_company_id" select2-model="ddl2Customer"
                       ng-disabled="contractBaseInfo.contract_status != 0"
                       config="ddlConfigCompany" class="form-control" type="text"/>
            </div>
        </div>
    </form>

    <form name="contractIncomeEdit" id="grid" class="table-wrap mt10 ml25" style="min-height: 200px;">
        <table width="100%">
            <thead>
            <tr>
                <th width="40">序号</th>
                <th width="100">收入项编码</th>
                <th width="100">业务收入项</th>
                <th width="100">财务收入项</th>
                <th width="80">确认方式</th>
                <th width="100" class="align-r">收入金额</th>
                <th width="100" class="align-r">累计已确认收入</th>
                <th width="100" class="align-r">未确认发生坏账</th>
                <th width="100" class="align-r">待确认收入</th>
                <th width="100" class="align-m">结转开始时间</th>
                <th width="150" class="align-m">权益日期</th>
                <th width="60">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="record in incomes">
                <td height="40"><p ng-bind="$index + 1"></p></td>
                <td>
                    <p ng-bind="record.income_code"></p>
                </td>
                <td class="align-m">
                    <p ng-bind="record.type_name"></p>
                </td>
                <td class="align-m">
                    <p ng-bind="record.finance_type_name"></p>
                </td>
                <td class="align-m">
                    <p ng-bind="record.confirm_type_name"></p>
                </td>
                <td class="align-r">
                    <p ng-bind="record.amount|number:2"></p>
                </td>
                <td class="align-r">
                    <p ng-bind="record.total_confirm_amount|number:2"></p>
                </td>
                <td class="align-r">
                    <p ng-bind="record.no_confirm_bad_amount|number:2"></p>

                    <!--<input type="number" number required min="0" ng-model="record.no_confirm_bad_amount"-->
                           <!--class="form-control align-r" id="inputtext3" data-ng-disabled="true" placeholder="坏账">-->
                </td>
                <td class="align-r">
                    <p ng-bind="record.wait_confirm_amount|number:2"></p>
                </td>
                <td class="align-m">
                    <p ng-bind="record.carryover_begin_time|strdate:'yyyy-MM-dd'"></p>
                </td>
                <td>
                    <p class="align-m" ng-if="record.type_name == '云链租用服务'">
                        {{record.right_begin_time|strdate:'yyyy-MM-dd'}}至{{record.right_end_time|strdate:'yyyy-MM-dd'}}
                    </p>
                </td>
                <td>
                    <div>
                        <a id="edit-income-btn"  href="javascript:void(0)"  ng-if="record.close_status == 0"
                                ui-dialog="修改收入信息"
                                ui-dialog-data="{'oid':record.revenue_id,'isEdit':true}"
                                ui-dialog-show="contractIncomeService.onIncomeEditShow($data,$dialog,$dialogScope)"
                                ui-dialog-ok="contractIncomeService.editIncomeSave($data,$dialog,$dialogScope,record)"
                                ui-dialog-cache="false"
                                ui-dialog-url="/contract/editinc/income-inc-edit.html">
                            修改
                        </a>

                        <a id="view-income-btn"  href="javascript:void(0)"  ng-if="record.close_status == 1"
                           ui-dialog="查看收入信息"
                           ui-dialog-data="{'oid':record.revenue_id,'isEdit':false}"
                           ui-dialog-show="contractIncomeService.onIncomeEditShow($data,$dialog,$dialogScope)"
                           ui-dialog-cache="false"
                           ui-dialog-url="/contract/editinc/income-inc-edit.html">
                            查看
                        </a>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="no-data" style="display:none"><span>暂无数据</span></div>
    </form>

    <div class="mt3 clearfix ng-scope ml25">
        <span  class="fl lh30 f14 c-orange">结转信息</span>
    </div>

    <form name="contractIncomeEdit2" id="grid2" class="table-wrap mt10 ml25" style="min-height: 200px;">
        <table width="100%">
            <thead>
            <tr>
                <th width="40">序号</th>
                <th width="100">收入项编码</th>
                <th width="100" class="align-r">收入金额</th>
                <th width="150" class="align-m">结转期间</th>
                <th width="110" class="align-r">上期累计确认收入</th>
                <th width="100" class="align-r">本期确认收入</th>
                <th width="110" class="align-r">本期累计确认收入</th>
                <th width="100" class="align-m">结转人</th>
                <th width="100" class="align-m">结转时间</th>
                <th width="60">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="record in carryovers">
                <td height="40"><p ng-bind="$index + 1"></p></td>
                <td>
                    <p ng-bind="record.income_code"></p>
                </td>
                <td class="align-r">
                    <p ng-bind="record.amount|number:2"></p>
                </td>
                <td>
                    <p class="align-m">
                        {{record.carryover_begin_time|strdate:'yyyy-MM-dd'}}至{{record.carryover_end_time|strdate:'yyyy-MM-dd'}}
                    </p>
                </td>
                <td class="align-r">
                    <p ng-bind="record.last_period_total_confirm_amount|number:2"></p>
                </td>
                <td class="align-r">
                    <p ng-bind="record.this_period_confirm_amount|number:2"></p>
                </td>
                <td class="align-r">
                    <p ng-bind="record.this_period_confirm_total_amount|number:2"></p>
                </td>
                <td class="align-m">
                    <p ng-bind="record.created_by"></p>
                </td>
                <td class="align-m">
                    <p ng-bind="record.created_on|strdate:'yyyy-MM-dd'"></p>
                </td>
                <td>
                    <div>
                        <a ng-if="record.created_on>=record.carryover_begin_time && record.created_on<=record.carryover_end_time" href="javascript:void(0)"
                           ui-dialog="调整结转数据"
                           ui-dialog-data="{}"
                           ui-dialog-show="contractIncomeService.onIncomeCarryoverEditShow(record,$dialog,$dialogScope)"
                           ui-dialog-ok="contractIncomeService.editIncomeCarryoverSave($data,$dialog,$dialogScope,record)"
                           ui-dialog-cache="false"
                           ui-dialog-url="/contract/editinc/income-carryover-inc-edit.html">
                            调整
                        </a>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="no-data" style="display:none"><span>暂无数据</span></div>
    </form>
</div>